//
//  UIResponder+STTools_FeedbackGenerator.m
//  togetherPlay
//
//  Created by coder on 2019/1/10.
//  Copyright © 2019 stoneobs.qq.com. All rights reserved.
//

#import "UIResponder+STTools_FeedbackGenerator.h"

@implementation UIResponder (STTools_FeedbackGenerator)

- (void)stoneobs_fun_st_showNotificationFeedback:(UINotificationFeedbackType)type{
    if (@available(iOS 10.0, *)) {
        dispatch_async(dispatch_get_main_queue(), ^{
            UINotificationFeedbackGenerator *stoneobs_temp_generator = [[UINotificationFeedbackGenerator alloc] init];
            [stoneobs_temp_generator prepare];
            [stoneobs_temp_generator notificationOccurred:type];
        });
    } else {
        // Fallback on earlier versions
    }
    
    
}
- (void)stoneobs_fun_st_showImpactFeedbackGenerator:(UIImpactFeedbackStyle)style{
    if (@available(iOS 10.0, *)) {
        dispatch_async(dispatch_get_main_queue(), ^{
            UIImpactFeedbackGenerator *stoneobs_temp_generator = [[UIImpactFeedbackGenerator alloc] initWithStyle:style];
            [stoneobs_temp_generator prepare];
            [stoneobs_temp_generator impactOccurred];
        });

    } else {
        // Fallback on earlier versions
    }
}
- (void)stoneobs_fun_st_showSelectionFeedbackGenerator{
    
    if (@available(iOS 10.0, *)) {
        dispatch_async(dispatch_get_main_queue(), ^{
            UISelectionFeedbackGenerator *stoneobs_temp_generator = [[UISelectionFeedbackGenerator alloc] init];
            [stoneobs_temp_generator prepare];
            [stoneobs_temp_generator selectionChanged];
        });

    } else {
        // Fallback on earlier versions
    }
    
}
@end

